import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * registration complete
 * illegal length
 * acount existed
 * illegal charactor
 */
public class Class1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Map<String,Integer> map = new HashMap<>();
        for (int i=0;i<n;i++){
            String s= scanner.next();
            if (s.length()<6||s.length()>12){
                System.out.println("illegal length");
                continue;
            }
            //检测是否出现字符以外的数字
            int flag =0;
            for (int j=0;j<s.length();j++){
                if ((s.charAt(j)>='a'&&s.charAt(j)<='z')||(
                        s.charAt(j)>='A'&&s.charAt(j)<='Z'
                        )){
                    continue;

                }
                else {
                    System.out.println("illegal charactor");
                    flag=1;
                     break;
                }
            }
            if (flag==0){
                if (map.containsKey(s))
                    System.out.println("acount existed");
                else {
                    map.put(s,0);
                    System.out.println("registration complete");
                }
            }



        }
    }
}
